package com.sky.zzh.analyse;

import java.io.File;
import java.io.FileOutputStream;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.Dialog;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.Fragment;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import cn.sharesdk.onekeyshare.OneKeyShareCallback;
import cn.sharesdk.onekeyshare.OnekeyShare;
import cn.sharesdk.onekeyshare.OnekeyShareTheme;

import com.next.intf.ITaskListener;
import com.next.net.SHGet;
import com.next.net.SHTask;
import com.sky.widget.SHDialog;
import com.sky.widget.sweetdialog.SweetDialog;
import com.sky.zzh.R;
import com.sky.zzh.util.CommonUtil;
import com.sky.zzh.util.ConfigDefinition;
import com.sky.zzh.util.UserInfoManager;
import com.sky.zzh.view.CalendarDialog;
import com.sky.zzh.view.CalendarDialog.CalendarResultListener;

/**
 * 睡眠分析
 * 
 * @author skypan
 * 
 */
public class AnalyseFragment extends Fragment implements ITaskListener {

	private ImageView mIvCalendar, mIvArrowLeft, mIvArrowRight;
	private Calendar calendar;
	private TextView mTvWeek, mTvTime;
	private final int FIRST_DAY = Calendar.SUNDAY;
	private SHGet analyseTask;
	private String fromDate, endDate;
	private TextView mTvHour, mTvMin;
	private TextView mTvLongDate, mTvLongTime, mTvLongSth, mTvShortDate, mTvShortTime, mTvShortSth;
	private ImageView mIvLong, mIvShort;
	private JSONArray mJSONArray;
	private TextView mTvLongTag,mTvShortTag;
	private FragmentManager fragmentManager;
	private FragmentTransaction fragmentTransaction;
	private AnaChartFragment fragment;
	private JSONObject longJson, shortJson;// 最长时间和最短时间
	private Button mBtnRight;
	private LinearLayout mLlLong,mLlShort;
	private String longest;
	private BroadcastReceiver rec = new BroadcastReceiver() {

		@Override
		public void onReceive(Context arg0, Intent arg1) {
			// TODO Auto-generated method stub
			requestData();
		}
	};

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		View view = inflater.inflate(R.layout.fragment_analyse, container, false);
		return view;
	}

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onViewCreated(view, savedInstanceState);
		mIvCalendar = (ImageView) view.findViewById(R.id.iv_calendar);
		mIvArrowLeft = (ImageView) view.findViewById(R.id.iv_arrow_left);
		mIvArrowRight = (ImageView) view.findViewById(R.id.iv_arrow_right);
		mTvWeek = (TextView) view.findViewById(R.id.tv_week);
		mTvTime = (TextView) view.findViewById(R.id.tv_time);
		mTvHour = (TextView) view.findViewById(R.id.tv_hour);
		mTvMin = (TextView) view.findViewById(R.id.tv_min);
		mTvLongDate = (TextView) view.findViewById(R.id.tv_long_date);
		mTvLongTime = (TextView) view.findViewById(R.id.tv_long_time);
		mTvLongSth = (TextView) view.findViewById(R.id.tv_long_sth);
		mTvShortDate = (TextView) view.findViewById(R.id.tv_short_date);
		mTvShortTime = (TextView) view.findViewById(R.id.tv_short_time);
		mTvShortSth = (TextView) view.findViewById(R.id.tv_short_sth);
		mIvLong = (ImageView) view.findViewById(R.id.iv_long);
		mIvShort = (ImageView) view.findViewById(R.id.iv_short);
		mBtnRight = (Button) view.findViewById(R.id.btn_right);
		mLlLong = (LinearLayout) view.findViewById(R.id.ll_long);
		mLlShort = (LinearLayout) view.findViewById(R.id.ll_short);
		mTvLongTag = (TextView) view.findViewById(R.id.tv_long_tag);
		mTvShortTag = (TextView) view.findViewById(R.id.tv_short_tag);
		registerBroadcast();
		setListeners();

		calendar = Calendar.getInstance();
		int year = calendar.get(Calendar.YEAR);
		int week = calendar.get(Calendar.WEEK_OF_YEAR);
		mTvWeek.setText(year + "年" + "第" + week + "周");

		StringBuilder sb = new StringBuilder();

		calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
		fromDate = calendar.get(Calendar.YEAR) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH));
		sb.append(CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "月" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH)) + "日");
		calendar.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
		endDate = calendar.get(Calendar.YEAR) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH));
		sb.append(" - ").append(CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "月" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH)) + "日");
		mTvTime.setText(sb);

		// activeFragment();

		requestData();
	}

	private void registerBroadcast() {
		IntentFilter intentFilter = new IntentFilter();
		intentFilter.addAction("device_change");
		getActivity().registerReceiver(rec, intentFilter);
	}

	public void activeFragment() {
		fragmentManager = getActivity().getFragmentManager();
		fragmentTransaction = fragmentManager.beginTransaction();
		fragment = AnaChartFragment.newInstance("2015-08-15", mJSONArray,longest);
		fragmentTransaction.replace(R.id.rl_chart, fragment);
		fragmentTransaction.commit();
	}

	private void requestData() {
		longJson = null;
		shortJson = null;
		SHDialog.ShowProgressDiaolg(getActivity());
		analyseTask = new SHGet();
		analyseTask.setListener(this);
		analyseTask.setUrl(ConfigDefinition.URL + "app/SleepQuality");
		analyseTask.getTaskArgs().put("UUID", UserInfoManager.getInstance().getUUID());
		// analyseTask.getTaskArgs().put("UUID", "MT003");
		System.out.println("UUID:" + UserInfoManager.getInstance().getUUID());
		analyseTask.getTaskArgs().put("UserId", UserInfoManager.getInstance().getUserId());
		analyseTask.getTaskArgs().put("FromDate", fromDate);
		analyseTask.getTaskArgs().put("EndDate", endDate);
		// analyseTask.getTaskArgs().put("FromTime",
		// URLEncoder.encode("18:00"));
		// analyseTask.getTaskArgs().put("EndTime", URLEncoder.encode("18:00"));
		analyseTask.start();
	}

	private void setListeners() {

		mBtnRight.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				GetandSaveCurrentImage();
				showShare(false, null, false);
			}
		});

		mIvCalendar.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				CalendarDialog dia = new CalendarDialog(getActivity(), new CalendarResultListener() {

					@Override
					public void onCalendarResult(Dialog d, String date) {
						// TODO Auto-generated method stub
						d.dismiss();
						SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
						try {
							Date dd = format.parse(date);
							calendar.setFirstDayOfWeek(Calendar.SUNDAY);
							calendar.setTime(dd);

							int year = calendar.get(Calendar.YEAR);
							int week = calendar.get(Calendar.WEEK_OF_YEAR);
							mTvWeek.setText(year + "年" + "第" + week + "周");
							StringBuilder sb = new StringBuilder();

							calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
							fromDate = calendar.get(Calendar.YEAR) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH));
							sb.append(CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "月" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH)) + "日");
							calendar.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
							endDate = calendar.get(Calendar.YEAR) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH));
							sb.append(" - ").append(CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "月" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH)) + "日");
							mTvTime.setText(sb);

							requestData();
						} catch (ParseException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
						// requestData();
					}
				});
				dia.show();
			}
		});

		mIvArrowLeft.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				calendar.add(Calendar.WEEK_OF_YEAR, -1);
				int year = calendar.get(Calendar.YEAR);
				int week = calendar.get(Calendar.WEEK_OF_YEAR);
				mTvWeek.setText(year + "年" + "第" + week + "周");
				StringBuilder sb = new StringBuilder();

				calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
				fromDate = calendar.get(Calendar.YEAR) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH));
				sb.append(CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "月" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH)) + "日");
				calendar.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
				endDate = calendar.get(Calendar.YEAR) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH));
				sb.append(" - ").append(CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "月" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH)) + "日");
				mTvTime.setText(sb);

				requestData();
			}
		});

		mIvArrowRight.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				calendar.add(Calendar.WEEK_OF_YEAR, 1);
				int year = calendar.get(Calendar.YEAR);
				int week = calendar.get(Calendar.WEEK_OF_YEAR);
				mTvWeek.setText(year + "年" + "第" + week + "周");
				StringBuilder sb = new StringBuilder();

				calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
				fromDate = calendar.get(Calendar.YEAR) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH));
				sb.append(CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "月" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH)) + "日");
				calendar.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
				endDate = calendar.get(Calendar.YEAR) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH));
				sb.append(" - ").append(CommonUtil.getDoubleNum(calendar.get(Calendar.MONTH) + 1) + "月" + CommonUtil.getDoubleNum(calendar.get(Calendar.DAY_OF_MONTH)) + "日");
				mTvTime.setText(sb);

				requestData();
			}
		});
	}

	@Override
	public void onTaskFinished(SHTask task) throws Exception {
		// TODO Auto-generated method stub
		SHDialog.dismissProgressDiaolg();
		System.out.println(task.getResult());
		JSONObject json = new JSONObject(task.getResult().toString());
		if ("200".equals(json.optString("ReturnCode"))) {
			String ave = json.optString("AverageSleepDuration");
			if (!"".equals(ave)) {

				String[] split = ave.split("\\.");
				int hour = Integer.valueOf(split[0]);
				int minute = 0;
				if (split.length > 1) {
					minute = Integer.valueOf(split[1]);
				}
				mTvHour.setText(hour + "");
				mTvMin.setText(minute * 60 / 100 + "");

				// int a = (int) (Double.valueOf(ave) * 60 / 60);
				// mTvHour.setText(a + "");
				// int b = (int) (Double.valueOf(ave) - Double.valueOf(a + ""))
				// * 60;
				// mTvMin.setText(b + "");
			} else {
				mTvHour.setText(0 + "");
				mTvMin.setText(0 + "");
			}
			mJSONArray = json.optJSONArray("Data");

			// 如果没有数据，就把图标清空
			// if(mJSONArray.length() == 0 && fragment != null){
			// fragmentTransaction.remove(fragment);
			// }
			// sortJsonArrayByDate("Date");

			// 新建一个数组，放7个空数据，然后遍历接口数据，判断日期是一周的第几天，把数组中相应的数据替换掉
			JSONArray finalArray = new JSONArray();
			for (int i = 0; i < 7; i++) {
				JSONObject tempJson = new JSONObject();
				try {
					tempJson.put("SleepDuration", "0");
					finalArray.put(tempJson);
				} catch (JSONException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}

			Calendar cal = Calendar.getInstance();
			for (int i = 0; i < mJSONArray.length(); i++) {
				if ("1".equals(mJSONArray.optJSONObject(i).optString("TagFlag"))) {// 睡眠最长
					longJson = mJSONArray.optJSONObject(i);
					longest  = longJson.optString("SleepDuration");
				}
				if ("-1".equals(mJSONArray.optJSONObject(i).optString("TagFlag"))) {
					shortJson = mJSONArray.optJSONObject(i);
				}
				SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
				Date dd = format.parse(mJSONArray.optJSONObject(i).optString("Date"));
				// cal.setFirstDayOfWeek(7);
				cal.setTime(dd);
				int whichDay1 = cal.get(Calendar.DAY_OF_WEEK);
				System.out.println("whichDay1:" + whichDay1);
				finalArray.put(whichDay1 - 1, mJSONArray.optJSONObject(i));
			}
			mJSONArray = finalArray;
			activeFragment();

			if (longJson != null) {
				mLlLong.setVisibility(View.VISIBLE);
				mTvLongDate.setText(longJson.optString("Date"));
				String l = longJson.optString("SleepDuration");
				// int la = (int) (Double.valueOf(l) * 60 / 60);
				// int lb = (int) (Double.valueOf(l) - Double.valueOf(la + ""))
				// * 60;

				String[] split = l.split("\\.");
				int hour = Integer.valueOf(split[0]);
				int minute = 0;
				if (split.length > 1) {
					minute = Integer.valueOf(split[1]);
				}

				mTvLongTime.setText(hour + "小时" + minute * 60 / 100 + "" + "分");
				mTvLongTag.setText(longJson.optString("TagsBeforeSleep"));
				mTvLongSth.setText(longJson.optString("TagsAfterSleep"));
				if (Double.valueOf(l) < 10) {
					LinearLayout.LayoutParams pa = new LayoutParams((int) (mIvLong.getWidth() * Double.valueOf(l) / 10), LayoutParams.WRAP_CONTENT);
					mIvLong.setLayoutParams(pa);
				}
			}else{
				mLlLong.setVisibility(View.GONE);
			}

			if (shortJson != null) {
				mLlShort.setVisibility(View.VISIBLE);
				mTvShortDate.setText(shortJson.optString("Date"));
				String l = shortJson.optString("SleepDuration");
				// int la = (int) (Double.valueOf(l) * 60 / 60);
				// int lb = (int) (Double.valueOf(l) - Double.valueOf(la + ""))
				// * 60;

				String[] split = l.split("\\.");
				int hour = Integer.valueOf(split[0]);
				int minute = 0;
				if (split.length > 1) {
					minute = Integer.valueOf(split[1]);
				}

				mTvShortTime.setText(hour + "小时" + minute * 60 / 100 + "" + "分");
				mTvShortTag.setText(longJson.optString("TagsBeforeSleep"));
				mTvShortSth.setText(longJson.optString("TagsAfterSleep"));

				if (Double.valueOf(l) < 10) {
					LinearLayout.LayoutParams pa = new LayoutParams((int) (mIvShort.getWidth() * Double.valueOf(l) / 10), LayoutParams.WRAP_CONTENT);
					mIvShort.setLayoutParams(pa);
				}
			}else{
				mLlShort.setVisibility(View.GONE);
			}

		} else {
			new SweetDialog(getActivity(), SweetDialog.ERROR_TYPE).setTitleText("提示").setContentText(json.optString("ErrorMessage")).show();
		}
	}

	/**
	 * 根据日期排序
	 * 
	 * @param dateName
	 */
	protected void sortJsonArrayByDate(String dateName) {
		List<JSONObject> list = new ArrayList<JSONObject>();
		JSONObject jsonObj = null;
		for (int i = 0; i < mJSONArray.length(); i++) {
			jsonObj = mJSONArray.optJSONObject(i);
			list.add(jsonObj);
			if ("1".equals(jsonObj.optString("TagFlag"))) {// 睡眠最长
				longJson = jsonObj;
			}
			if ("-1".equals(jsonObj.optString("TagFlag"))) {
				shortJson = jsonObj;
			}
		}
		// 排序操作
		JsonComparator pComparator = new JsonComparator(dateName);
		Collections.sort(list, pComparator);

		// 把数据放回去
		mJSONArray = new JSONArray();
		for (int i = 0; i < list.size(); i++) {
			jsonObj = list.get(i);
			mJSONArray.put(jsonObj);
		}
		while (mJSONArray.length() < 7) {
			JSONObject tempJson = new JSONObject();
			try {
				tempJson.put("SleepDuration", "0");
				mJSONArray.put(tempJson);
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		// System.out.println(mJSONArray);
		activeFragment();
	}

	public class JsonComparator implements Comparator<JSONObject> {

		String dateName = "";

		JsonComparator(String dateName) {
			this.dateName = dateName;
		}

		@Override
		public int compare(JSONObject json1, JSONObject json2) {
			String date1 = json1.optString(dateName);
			String date2 = json2.optString(dateName);
			if (date1.compareTo(date2) < 0) {
				return -1;
			} else if (date1.compareTo(date2) > 0) {
				return 1;
			}
			return 0;
		}
	}

	private void GetandSaveCurrentImage() {
		SHDialog.ShowProgressDiaolg(getActivity(), "正在截图...");
		WindowManager windowManager = getActivity().getWindowManager();
		Display display = windowManager.getDefaultDisplay();
		int w = display.getWidth();
		int h = display.getHeight();
		Bitmap Bmp = Bitmap.createBitmap(w, h, Config.ARGB_8888);
		View decorview = getActivity().getWindow().getDecorView();
		decorview.setDrawingCacheEnabled(true);
		Bmp = decorview.getDrawingCache();
		String SavePath = getSDCardPath() + "/zzh/ScreenImages";
		try {
			File path = new File(SavePath);
			String filepath = SavePath + "/Screen_share.png";
			File file = new File(filepath);
			if (!path.exists()) {
				path.mkdirs();
			}
			if (!file.exists()) {
				file.createNewFile();
			}
			FileOutputStream fos = null;
			fos = new FileOutputStream(file);
			if (null != fos) {
				Bmp.compress(Bitmap.CompressFormat.PNG, 90, fos);
				fos.flush();
				fos.close();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		SHDialog.dismissProgressDiaolg();
	}

	private String getSDCardPath() {
		File sdcardDir = null;
		boolean sdcardExist = Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
		if (sdcardExist) {
			sdcardDir = Environment.getExternalStorageDirectory();
		}
		return sdcardDir.toString();
	}

	private void showShare(boolean silent, String platform, boolean captureView) {
		final OnekeyShare oks = new OnekeyShare();

		// oks.setAddress("12345678901");
		oks.setTitle("智照护");
		// oks.setTitleUrl("http://mob.com");
		oks.setText("");
		oks.setImagePath(getSDCardPath() + "/zzh/ScreenImages" + "/Screen_share.png");
		// oks.setImagePath(CustomShareFieldsPage.getString("imagePath",
		// MainActivity.TEST_IMAGE));
		// oks.setImageUrl("http://f1.sharesdk.cn/imgs/2014/05/21/oESpJ78_533x800.jpg");
		// oks.setImageArray(new String[]{MainActivity.TEST_IMAGE,
		// MainActivity.TEST_IMAGE_URL});

		// oks.setUrl("http://www.mob.com");
		// oks.setFilePath(CustomShareFieldsPage.getString("filePath",
		// MainActivity.TEST_IMAGE));
		// oks.setComment(CustomShareFieldsPage.getString("comment",
		// context.getString(R.string.share)));
		// oks.setSite(getActivity().getResources().getString(R.string.app_name));
		// oks.setSiteUrl("http://mob.com");
		// oks.setVenueName(CustomShareFieldsPage.getString("venueName",
		// "ShareSDK"));
		// oks.setVenueDescription(CustomShareFieldsPage.getString("venueDescription",
		// "This is a beautiful place!"));
		// oks.setLatitude(23.056081f);
		// oks.setLongitude(113.385708f);
		oks.setSilent(silent);
		// oks.setShareFromQQAuthSupport(shareFromQQLogin);
		oks.setTheme(OnekeyShareTheme.CLASSIC);

		if (platform != null) {
			oks.setPlatform(platform);
		}

		// 令编辑页面显示为Dialog模式
		oks.setDialogMode();

		// 在自动授权时可以禁用SSO方式
		// if(!CustomShareFieldsPage.getBoolean("enableSSO", true))
		oks.disableSSOWhenAuthorize();

		// 去除注释，则快捷分享的操作结果将通过OneKeyShareCallback回调
		oks.setCallback(new OneKeyShareCallback());

		// 为EditPage设置一个背景的View
		// oks.setEditPageBackground(getPage());
		oks.show(getActivity());
	}

	@Override
	public void onTaskFailed(SHTask task) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onTaskUpdateProgress(SHTask task, int count, int total) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onTaskTry(SHTask task) {
		// TODO Auto-generated method stub

	}
}
